home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / comm / mail / YAM22src.lha / YAM_COs.c < prev    next >
C/C++ Source or Header  |  2000-11-03  |  52KB  |  871 lines

  1. /***************************************************************************
  2.  
  3.  YAM - Yet Another Mailer
  4.  Copyright (C) 2000  Marcel Beck <mbeck@yam.ch>
  5.  
  6.  This program is free software; you can redistribute it and/or modify
  7.  it under the terms of the GNU General Public License as published by
  8.  the Free Software Foundation; either version 2 of the License, or
  9.  (at your option) any later version.
  10.  
  11.  This program is distributed in the hope that it will be useful,
  12.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  GNU General Public License for more details.
  15.  
  16.  You should have received a copy of the GNU General Public License
  17.  along with this program; if not, write to the Free Software
  18.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  
  20.  YAM Official Support Site :  http://www.yam.ch
  21.  YAM OpenSource project    :  http://sourceforge.net/projects/yamos/
  22.  
  23. ***************************************************************************/
  24.  
  25. #include "YAM.h"
  26.  
  27. /***************************************************************************
  28.  Module: Configuration - Basic Get/Put routines
  29. ***************************************************************************/
  30.  
  31. /// Bool2Txt
  32. //  Converts boolean value to text
  33. char *Bool2Txt(BOOL bool)
  34. {
  35.    return bool ? "Y" : "N";
  36. }
  37. ///
  38. /// Txt2Bool
  39. //  Converts Y/N string to boolean value
  40. BOOL Txt2Bool(char *txt)
  41. {
  42.    return (BOOL)(tolower((int)*txt) == 'y');
  43. }
  44. ///
  45. /// CO_SaveConfig
  46. //  Saves configuration to a file
  47. void CO_SaveConfig(struct Config *co, char *fname)
  48. {
  49.    FILE *fh;
  50.    int i;
  51.    
  52.    if (fh = fopen(fname, "w"))
  53.    {
  54.       fprintf(fh, "YCO3 - YAM Configuration\n");
  55.       fprintf(fh, "\n[First steps]\n");
  56.       fprintf(fh, "RealName         = %s\n", co->RealName);
  57.       fprintf(fh, "EmailAddress     = %s\n", co->EmailAddress);
  58.       fprintf(fh, "TimeZone         = %ld\n", co->TimeZone);
  59.       fprintf(fh, "DaylightSaving   = %s\n", Bool2Txt(co->DaylightSaving));
  60.       fprintf(fh, "\n[TCP/IP]\n");
  61.       fprintf(fh, "SMTP-Server      = %s\n", co->SMTP_Server);
  62.       fprintf(fh, "SMTP-Domain      = %s\n", co->SMTP_Domain);
  63.       fprintf(fh, "Allow8bit        = %s\n", Bool2Txt(co->Allow8bit));
  64.       for (i = 0; i < MAXP3; i++) if (co->P3[i])
  65.       {
  66.       struct POP3 *p3 = co->P3[i];
  67.       fprintf(fh, "POP%02ld.Server     = %s\n", i, p3->Server);
  68.       fprintf(fh, "POP%02ld.User       = %s\n", i, p3->User);
  69.       fprintf(fh, "POP%02ld.Password   = %s\n", i, Encrypt(p3->Password));
  70.       fprintf(fh, "POP%02ld.Enabled    = %s\n", i, Bool2Txt(p3->Enabled));
  71.       fprintf(fh, "POP%02ld.UseAPOP    = %s\n", i, Bool2Txt(p3->UseAPOP));
  72.       fprintf(fh, "POP%02ld.Delete     = %s\n", i, Bool2Txt(p3->DeleteOnServer));
  73.       }
  74.       fprintf(fh, "\n[New mail]\n");
  75.       fprintf(fh, "AvoidDuplicates  = %s\n", Bool2Txt(co->AvoidDuplicates));
  76.       fprintf(fh, "PreSelection     = %ld\n", co->PreSelection);
  77.       fprintf(fh, "TransferWindow   = %ld\n", co->TransferWindow);
  78.       fprintf(fh, "UpdateStatus     = %s\n", Bool2Txt(co->UpdateStatus));
  79.       fprintf(fh, "WarnSize         = %ld\n", co->WarnSize);
  80.       fprintf(fh, "CheckMailDelay   = %ld\n", co->CheckMailDelay);
  81.       fprintf(fh, "DownloadLarge    = %s\n", Bool2Txt(co->DownloadLarge));
  82.       fprintf(fh, "NotifyType       = %ld\n", co->NotifyType);
  83.       fprintf(fh, "NotifySound      = %s\n", co->NotifySound);
  84.       fprintf(fh, "NotifyCommand    = %s\n", co->NotifyCommand);
  85.       fprintf(fh, "\n[Filters]\n");
  86.       for (i = 0; i < MAXRU; i++) if (co->RU[i])
  87.       {
  88.       struct Rule *ru = co->RU[i];
  89.       fprintf(fh, "FI%02ld.Name        = %s\n", i, ru->Name);
  90.       fprintf(fh, "FI%02ld.Remote      = %s\n", i, Bool2Txt(ru->Remote));
  91.       fprintf(fh, "FI%02ld.ApplyToNew  = %s\n", i, Bool2Txt(ru->ApplyToNew));
  92.       fprintf(fh, "FI%02ld.ApplyToSent = %s\n", i, Bool2Txt(ru->ApplyToSent));
  93.       fprintf(fh, "FI%02ld.ApplyOnReq  = %s\n", i, Bool2Txt(ru->ApplyOnReq));
  94.       fprintf(fh, "FI%02ld.Field       = %ld\n", i, ru->Field[0]);
  95.       fprintf(fh, "FI%02ld.SubField    = %ld\n", i, ru->SubField[0]);
  96.       fprintf(fh, "FI%02ld.CustomField = %s\n", i, ru->CustomField[0]);
  97.       fprintf(fh, "FI%02ld.Comparison  = %ld\n", i, ru->Comparison[0]);
  98.       fprintf(fh, "FI%02ld.Match       = %s\n", i, ru->Match[0]);
  99.       fprintf(fh, "FI%02ld.CaseSens    = %s\n", i, Bool2Txt(ru->CaseSens[0]));
  100.       fprintf(fh, "FI%02ld.Substring   = %s\n", i, Bool2Txt(ru->Substring[0]));
  101.       fprintf(fh, "FI%02ld.Combine     = %ld\n", i, ru->Combine);
  102.       if (ru->Combine)
  103.       {
  104.          fprintf(fh, "FI%02ld.Field2      = %ld\n", i, ru->Field[1]);
  105.          fprintf(fh, "FI%02ld.SubField2   = %ld\n", i, ru->SubField[1]);
  106.          fprintf(fh, "FI%02ld.CustomField2= %s\n", i, ru->CustomField[1]);
  107.          fprintf(fh, "FI%02ld.Comparison2 = %ld\n", i, ru->Comparison[1]);
  108.          fprintf(fh, "FI%02ld.Match2      = %s\n", i, ru->Match[1]);
  109.          fprintf(fh, "FI%02ld.CaseSens2   = %s\n", i, Bool2Txt(ru->CaseSens[1]));
  110.          fprintf(fh, "FI%02ld.Substring2  = %s\n", i, Bool2Txt(ru->Substring[1]));
  111.       }
  112.       fprintf(fh, "FI%02ld.Actions     = %ld\n", i, ru->Actions);
  113.       fprintf(fh, "FI%02ld.BounceTo    = %s\n", i, ru->BounceTo);
  114.       fprintf(fh, "FI%02ld.ForwardTo   = %s\n", i, ru->ForwardTo);
  115.       fprintf(fh, "FI%02ld.ReplyFile   = %s\n", i, ru->ReplyFile);
  116.       fprintf(fh, "FI%02ld.ExecuteCmd  = %s\n", i, ru->ExecuteCmd);
  117.       fprintf(fh, "FI%02ld.PlaySound   = %s\n", i, ru->PlaySound);
  118.       fprintf(fh, "FI%02ld.MoveTo      = %s\n", i, ru->MoveTo);
  119.       }
  120.       fprintf(fh, "\n[Read]\n");
  121.       fprintf(fh, "ShowHeader       = %ld\n", co->ShowHeader);
  122.       fprintf(fh, "ShortHeaders     = %s\n", co->ShortHeaders);
  123.       fprintf(fh, "ShowSenderInfo   = %ld\n", co->ShowSenderInfo);
  124.       fprintf(fh, "WrapHeader       = %s\n", Bool2Txt(co->WrapHeader));
  125.       fprintf(fh, "SigSepLine       = %ld\n", co->SigSepLine);
  126.       fprintf(fh, "ColoredText      = %s\n", co->ColoredText.buf);
  127.       fprintf(fh, "Color2ndLevel    = %s\n", co->Color2ndLevel.buf);
  128.       fprintf(fh, "DisplayAllTexts  = %s\n", Bool2Txt(co->DisplayAllTexts));
  129.       fprintf(fh, "FixedFontEdit    = %s\n", Bool2Txt(co->FixedFontEdit));
  130.       fprintf(fh, "UseTextstyles    = %s\n", Bool2Txt(co->UseTextstyles));
  131.       fprintf(fh, "MultipleWindows  = %s\n", Bool2Txt(co->MultipleWindows));
  132.       fprintf(fh, "TranslationIn    = %s\n", co->TranslationIn);
  133.       fprintf(fh, "\n[Write]\n");
  134.       fprintf(fh, "ReplyTo          = %s\n", co->ReplyTo);
  135.       fprintf(fh, "Organization     = %s\n", co->Organization);
  136.       fprintf(fh, "ExtraHeaders     = %s\n", co->ExtraHeaders);
  137.       fprintf(fh, "NewIntro         = %s\n", co->NewIntro);
  138.       fprintf(fh, "Greetings        = %s\n", co->Greetings);
  139.       fprintf(fh, "TranslationOut   = %s\n", co->TranslationOut);
  140.       fprintf(fh, "EdWrapCol        = %ld\n", co->EdWrapCol);
  141.       fprintf(fh, "EdWrapMode       = %ld\n", co->EdWrapMode);
  142.       fprintf(fh, "Editor           = %s\n", co->Editor);
  143.       fprintf(fh, "LaunchAlways     = %s\n", Bool2Txt(co->LaunchAlways));
  144.       fprintf(fh, "\n[Reply/Forward]\n");
  145.       fprintf(fh, "ReplyHello       = %s\n", co->ReplyHello);
  146.       fprintf(fh, "ReplyIntro       = %s\n", co->ReplyIntro);
  147.       fprintf(fh, "ReplyBye         = %s\n", co->ReplyBye);
  148.       fprintf(fh, "AltReplyHello    = %s\n", co->AltReplyHello);
  149.       fprintf(fh, "AltReplyIntro    = %s\n", co->AltReplyIntro);
  150.       fprintf(fh, "AltReplyBye      = %s\n", co->AltReplyBye);
  151.       fprintf(fh, "AltReplyPattern  = %s\n", co->AltReplyPattern);
  152.       fprintf(fh, "MLReplyHello     = %s\n", co->MLReplyHello);
  153.       fprintf(fh, "MLReplyIntro     = %s\n", co->MLReplyIntro);
  154.       fprintf(fh, "MLReplyBye       = %s\n", co->MLReplyBye);
  155.       fprintf(fh, "ForwardIntro     = %s\n", co->ForwardIntro);
  156.       fprintf(fh, "ForwardFinish    = %s\n", co->ForwardFinish);
  157.       fprintf(fh, "QuoteMessage     = %s\n", Bool2Txt(co->QuoteMessage));
  158.       fprintf(fh, "QuoteText        = %s\n", co->QuoteText);
  159.       fprintf(fh, "QuoteEmptyLines  = %s\n", Bool2Txt(co->QuoteEmptyLines));
  160.       fprintf(fh, "CompareAddress   = %s\n", Bool2Txt(co->CompareAddress));
  161.       fprintf(fh, "StripSignature   = %s\n", Bool2Txt(co->StripSignature));
  162.       fprintf(fh, "\n[Signature]\n");
  163.       fprintf(fh, "UseSignature     = %s\n", Bool2Txt(co->UseSignature));
  164.       fprintf(fh, "TagsFile         = %s\n", co->TagsFile);
  165.       fprintf(fh, "TagsSeparator    = %s\n", co->TagsSeparator);
  166.       fprintf(fh, "\n[Lists]\n");
  167.       fprintf(fh, "FolderCols       = %ld\n", co->FolderCols);
  168.       fprintf(fh, "MessageCols      = %ld\n", co->MessageCols);
  169.       fprintf(fh, "FixedFontList    = %s\n", Bool2Txt(co->FixedFontList));
  170.       fprintf(fh, "SwatchBeat       = %s\n", Bool2Txt(co->SwatchBeat));
  171.       fprintf(fh, "\n[Security]\n");
  172.       fprintf(fh, "PGPCmdPath       = %s\n", co->PGPCmdPath);
  173.       fprintf(fh, "MyPGPID          = %s\n", co->MyPGPID);
  174.       fprintf(fh, "EncryptToSelf    = %s\n", Bool2Txt(co->EncryptToSelf));
  175.       fprintf(fh, "ReMailer         = %s\n", co->ReMailer);
  176.       fprintf(fh, "RMCommands       = %s\n", co->RMCommands);
  177.       fprintf(fh, "LogfilePath      = %s\n", co->LogfilePath);
  178.       fprintf(fh, "LogfileMode      = %ld\n", co->LogfileMode);
  179.       fprintf(fh, "SplitLogfile     = %s\n", Bool2Txt(co->SplitLogfile));
  180.       fprintf(fh, "LogAllEvents     = %s\n", Bool2Txt(co->LogAllEvents));
  181.       fprintf(fh, "\n[Start/Quit]\n");
  182.       fprintf(fh, "GetOnStartup     = %s\n", Bool2Txt(co->GetOnStartup));
  183.       fprintf(fh, "SendOnStartup    = %s\n", Bool2Txt(co->SendOnStartup));
  184.       fprintf(fh, "CleanupOnStartup = %s\n", Bool2Txt(co->CleanupOnStartup));
  185.       fprintf(fh, "RemoveOnStartup  = %s\n", Bool2Txt(co->RemoveOnStartup));
  186.       fprintf(fh, "LoadAllFolders   = %s\n", Bool2Txt(co->LoadAllFolders));
  187.       fprintf(fh, "UpdateNewMail    = %s\n", Bool2Txt(co->UpdateNewMail));
  188.       fprintf(fh, "CheckBirthdates  = %s\n", Bool2Txt(co->CheckBirthdates));
  189.       fprintf(fh, "SendOnQuit       = %s\n", Bool2Txt(co->SendOnQuit));
  190.       fprintf(fh, "CleanupOnQuit    = %s\n", Bool2Txt(co->CleanupOnQuit));
  191.       fprintf(fh, "RemoveOnQuit     = %s\n", Bool2Txt(co->RemoveOnQuit));
  192.       fprintf(fh, "\n[MIME]\n");
  193.       for (i = 0; i < MAXMV; i++) if (co->MV[i])
  194.       {
  195.       fprintf(fh, "MV%02ld.ContentType = %s\n", i, co->MV[i]->ContentType);
  196.       fprintf(fh, "MV%02ld.Extension   = %s\n", i, co->MV[i]->Extension);
  197.       fprintf(fh, "MV%02ld.Command     = %s\n", i, co->MV[i]->Command);
  198.       }
  199.       fprintf(fh, "IdentifyBin      = %s\n", Bool2Txt(co->IdentifyBin));
  200.       fprintf(fh, "DetachDir        = %s\n", co->DetachDir);
  201.       fprintf(fh, "AttachDir        = %s\n", co->AttachDir);
  202.       fprintf(fh, "\n[Address book]\n");
  203.       fprintf(fh, "GalleryDir       = %s\n", co->GalleryDir);
  204.       fprintf(fh, "MyPictureURL     = %s\n", co->MyPictureURL);
  205.       fprintf(fh, "ProxyServer      = %s\n", co->ProxyServer);
  206.       fprintf(fh, "NewAddrGroup     = %s\n", co->NewAddrGroup);
  207.       fprintf(fh, "AddToAddrbook    = %ld\n", co->AddToAddrbook);
  208.       fprintf(fh, "AddMyInfo        = %s\n", Bool2Txt(co->AddMyInfo));
  209.       fprintf(fh, "AddrbookCols     = %ld\n", co->AddrbookCols);
  210.       fprintf(fh, "\n[Scripts]\n");
  211.       for (i = 0; i < MAXRX; i++)
  212.       {
  213.       if (i < 10) fprintf(fh, "Rexx%02ld.Name      = %s\n", i, co->RX[i].Name);
  214.       fprintf(fh, "Rexx%02ld.Script    = %s\n", i, co->RX[i].Script);
  215.       fprintf(fh, "Rexx%02ld.IsAmigaDOS= %s\n", i, Bool2Txt(co->RX[i].IsAmigaDOS));
  216.       fprintf(fh, "Rexx%02ld.UseConsole= %s\n", i, Bool2Txt(co->RX[i].UseConsole));
  217.       fprintf(fh, "Rexx%02ld.WaitTerm  = %s\n", i, Bool2Txt(co->RX[i].WaitTerm));
  218.       }
  219.       fprintf(fh, "\n[Mixed]\n");
  220.       fprintf(fh, "TempDir          = %s\n", co->TempDir);
  221.       fprintf(fh, "IconPosition     = %ld;%ld\n", co->IconPositionX, co->IconPositionY);
  222.       fprintf(fh, "IconifyOnQuit    = %s\n", Bool2Txt(co->IconifyOnQuit));
  223.       fprintf(fh, "Confirm          = %s\n", Bool2Txt(co->Confirm));
  224.       fprintf(fh, "ConfirmDelete    = %ld\n", co->ConfirmDelete);
  225.       fprintf(fh, "RemoveAtOnce     = %s\n", Bool2Txt(co->RemoveAtOnce));
  226.       fprintf(fh, "SaveSent         = %s\n", Bool2Txt(co->SaveSent));
  227.       fprintf(fh, "MDN_Display      = %ld\n", co->MDN_Display);
  228.       fprintf(fh, "MDN_Process      = %ld\n", co->MDN_Process);
  229.       fprintf(fh, "MDN_Delete       = %ld\n", co->MDN_Delete);
  230.       fprintf(fh, "MDN_Filter       = %ld\n", co->MDN_Filter);
  231.       fprintf(fh, "SendMDNAtOnce    = %s\n", Bool2Txt(co->SendMDNAtOnce));
  232.       fprintf(fh, "XPKPack          = %s;%ld\n", co->XPKPack, co->XPKPackEff);
  233.       fprintf(fh, "XPKPackEncrypt   = %s;%ld\n", co->XPKPackEncrypt, co->XPKPackEncryptEff);
  234.       fprintf(fh, "PackerCommand    = %s\n", co->PackerCommand);
  235.       fprintf(fh, "\n[Advanced]\n");
  236.       fprintf(fh, "LetterPart       = %ld\n", co->LetterPart);
  237.       fprintf(fh, "WriteIndexes     = %ld\n", co->WriteIndexes);
  238.       fprintf(fh, "AutoSave         = %ld\n", co->AutoSave);
  239.       fprintf(fh, "SupportSite      = %s\n", co->SupportSite);
  240.       fprintf(fh, "JumpToNewMsg     = %s\n", Bool2Txt(co->JumpToNewMsg));
  241.       fprintf(fh, "PrinterCheck     = %s\n", Bool2Txt(co->PrinterCheck));
  242.       fprintf(fh, "IsOnlineCheck    = %s\n", Bool2Txt(co->IsOnlineCheck));
  243.       fprintf(fh, "IOCInterface     = %s\n", co->IOCInterface);
  244.       fprintf(fh, "ConfirmOnQuit    = %s\n", Bool2Txt(co->ConfirmOnQuit));
  245.       fprintf(fh, "HideGUIElements  = %ld\n", co->HideGUIElements);
  246.       fprintf(fh, "LocalCharset     = %s\n", co->LocalCharset);
  247.       fprintf(fh, "StackSize        = %ld\n", co->StackSize);
  248.       fclose(fh);
  249.       AppendLogVerbose(60, GetStr(MSG_LOG_SavingConfig), fname, "", "", "");
  250.    }
  251.    else ER_NewError(GetStr(MSG_ER_CantCreateFile), fname, NULL);
  252. }
  253. ///
  254. /// CO_LoadConfig
  255. //  Loads configuration from a file
  256. BOOL CO_LoadConfig(struct Config *co, char *fname, struct Folder ***oldfolders)
  257. {
  258.    struct Folder **ofo = NULL;
  259.    FILE *fh;
  260.    char buffer[SIZE_LARGE];
  261.    int version;
  262.    
  263.    if (fh = fopen(fname, "r"))
  264.    {
  265.       fgets(buffer, SIZE_LARGE, fh);
  266.       if (!Strnicmp(buffer, "YCO", 3))
  267.       {
  268.          version = buffer[3]-'0';
  269.          CO_SetDefaults(co, -1);
  270.          while (fgets(buffer, SIZE_LARGE, fh))
  271.          {
  272.             char *p, *p2, *value, *value2 = "";
  273.             if (value = strchr(buffer, '=')) for (value2 = (++value)+1; ISpace(*value); value++);
  274.             if (p = strpbrk(buffer,"\r\n")) *p = 0;
  275.             for (p = buffer; *p && *p != '=' && !ISpace(*p); p++); *p = 0;
  276.             if (*buffer && value)
  277.             {
  278.                if (version == 2)
  279.                {
  280.                   if (!stricmp(buffer, "POP3-Server"))    stccpy(co->P3[0]->Server, value, SIZE_HOST);
  281.                   if (!stricmp(buffer, "POP3-Password"))  stccpy(co->P3[0]->Password, Decrypt(value), SIZE_PASSWORD);
  282.                   if (!stricmp(buffer, "POP3-User"))      stccpy(co->P3[0]->User, value, SIZE_USERID);
  283.                   if (!stricmp(buffer, "DeleteOnServer")) co->P3[0]->DeleteOnServer = Txt2Bool(value);
  284.                   if (!stricmp(buffer, "CheckMail"))      if (!Txt2Bool(value)) co->CheckMailDelay = 0;
  285.                   if (!stricmp(buffer, "ConfirmSize")) switch (atoi(value))
  286.                   {
  287.                      case  0: co->PreSelection = 2; co->WarnSize = 0; break;
  288.                      case 13: co->PreSelection = 0; co->WarnSize = 0; break;
  289.                      default: co->PreSelection = 1; co->WarnSize = 1<<atoi(value); break;
  290.                   }
  291.                   if (!stricmp(buffer, "Verbosity"))      co->TransferWindow = atoi(value) > 0 ? 2 : 0;
  292.                   if (!stricmp(buffer, "WordWrap"))       co->EdWrapCol = atoi(value);
  293.                   if (!stricmp(buffer, "DeleteOnExit"))   co->RemoveAtOnce = !(co->RemoveOnQuit = Txt2Bool(value));
  294.                   if (!strnicmp(buffer, "Folder", 6) && oldfolders)
  295.                   {
  296.                      static int sortconv[4] = { -1, 1, 3, 5 };
  297.                      int j = atoi(&buffer[6]), type;
  298.                      if (!ofo) ofo = *oldfolders = calloc(100, sizeof(struct Folder *));
  299.                      if (j >= 3) for (j = 4; j < 100; j++) if (!ofo[j]) break;
  300.                      type = (j == 0 ? FT_INCOMING : (j == 1 ? FT_OUTGOING : (j == 2 ? FT_SENT : FT_CUSTOM)));
  301.                      p = strchr(&value[4], ';'); *p++ = 0;
  302.                      if (!ofo[j]) if (ofo[j] = FO_NewFolder(type, &value[4], p)) ofo[j]->Sort[0] = sortconv[atoi(&value[2])];
  303.                   }
  304.                   if (!strnicmp(buffer, "Rule", 4))
  305.                   {
  306.                      int j = atoi(&buffer[4]);
  307.                      struct Rule *ru = co->RU[j];
  308.                      if (!ru) ru = co->RU[j] = CO_NewRule();
  309.                      ru->ApplyToNew = ru->ApplyOnReq = Txt2Bool(value);
  310.                      p = strchr(p2 = &value[2], ';'); *p++ = 0;
  311.                      stccpy(ru->Name, p2, SIZE_NAME);
  312.                      if ((ru->Field[0] = atoi(p)) == 2) ru->Field[0] = 4;
  313.                      ru->CaseSens[0] = Txt2Bool(&p[2]);
  314.                      ru->Comparison[0] = Txt2Bool(&p[4]) ? 1 : 0;
  315.                      p = strchr(p2 = &p[6], ';'); *p++ = 0;
  316.                      stccpy(ru->Match[0], p2, SIZE_PATTERN);
  317.                      switch (atoi(p))
  318.                      {
  319.                         case 0: ru->Actions = 32; break;
  320.                         case 1: ru->Actions = 64; break;
  321.                         case 2: ru->Actions = 2; break;
  322.                      }
  323.                      p = strchr(p2 = &p[2], ';'); *p++ = 0;
  324.                      stccpy(ru->MoveTo, p2, SIZE_NAME);
  325.                      stccpy(ru->ForwardTo, p, SIZE_ADDRESS);
  326.                      if (*ru->ForwardTo) ru->Actions |= 2;
  327.                   }
  328.                   if (!strnicmp(buffer, "MimeViewer", 10))
  329.                   {
  330.                      int j = atoi(&buffer[10]);
  331.                      struct MimeView *mv = co->MV[j];
  332.                      if (!mv) mv = co->MV[j] = CO_NewMimeView();
  333.                      p = strchr(value, ';'); *p++ = 0;
  334.                      stccpy(mv->ContentType, value, SIZE_CTYPE);
  335.                      stccpy(mv->Command, p, SIZE_COMMAND);
  336.                   }
  337.                   if (!Strnicmp(buffer, "RexxMenu", 8))
  338.                   {
  339.                      int j = atoi(&buffer[8]);
  340.                      stccpy(co->RX[j].Name, FilePart(value), SIZE_NAME);
  341.                      stccpy(co->RX[j].Script, value, SIZE_PATHFILE);
  342.                   }
  343.                }
  344.                if (!strnicmp(buffer, "FolderPath", 10) && oldfolders)
  345.                {
  346.                   int j = atoi(&buffer[10]);
  347.                   if (!ofo) ofo = *oldfolders = calloc(100, sizeof(struct Folder *));
  348.                   if (!ofo[j]) ofo[j] = FO_NewFolder(FT_CUSTOM, value, FilePart(value));
  349.                   if (!FO_LoadConfig(ofo[j])) FO_SaveConfig(ofo[j]);
  350.                }
  351. /*0*/          if (!stricmp(buffer, "RealName"))       stccpy(co->RealName, value, SIZE_REALNAME);
  352.                if (!stricmp(buffer, "EmailAddress"))   stccpy(co->EmailAddress, value, SIZE_ADDRESS);
  353.                if (!stricmp(buffer, "TimeZone"))       co->TimeZone = atoi(value);
  354.                if (!stricmp(buffer, "DaylightSaving")) co->DaylightSaving = Txt2Bool(value);
  355. /*1*/          if (!stricmp(buffer, "SMTP-Server"))    stccpy(co->SMTP_Server, value, SIZE_HOST);
  356.                if (!stricmp(buffer, "SMTP-Domain"))    stccpy(co->SMTP_Domain, value, SIZE_HOST);
  357.                if (!stricmp(buffer, "Allow8bit"))      co->Allow8bit = Txt2Bool(value);
  358.                if (!strnicmp(buffer, "POP", 3) && buffer[5] == '.')
  359.                {
  360.                   int j = atoi(&buffer[3]);
  361.                   struct POP3 *p3 = co->P3[j];
  362.                   p = &buffer[6];
  363.                   if (!p3) p3 = co->P3[j] = CO_NewPOP3(co, FALSE);
  364.                   if (!stricmp(p, "Server"))    stccpy(p3->Server, value, SIZE_HOST);
  365.                   if (!stricmp(p, "Password"))  stccpy(p3->Password, Decrypt(value), SIZE_PASSWORD);
  366.                   if (!stricmp(p, "User"))      stccpy(p3->User, value, SIZE_USERID);
  367.                   if (!stricmp(p, "Enabled"))   p3->Enabled = Txt2Bool(value);
  368.                   if (!stricmp(p, "UseAPOP"))   p3->UseAPOP = Txt2Bool(value);
  369.                   if (!stricmp(p, "Delete"))    p3->DeleteOnServer = Txt2Bool(value);
  370.                }
  371. /*2*/          if (!stricmp(buffer, "AvoidDuplicates"))co->AvoidDuplicates = Txt2Bool(value);
  372.                if (!stricmp(buffer, "PreSelection"))   co->PreSelection = atoi(value);
  373.                if (!stricmp(buffer, "TransferWindow")) co->TransferWindow = atoi(value);
  374.                if (!stricmp(buffer, "UpdateStatus"))   co->UpdateStatus = Txt2Bool(value);
  375.                if (!stricmp(buffer, "WarnSize"))       co->WarnSize = atoi(value);
  376.                if (!stricmp(buffer, "CheckMailDelay")) co->CheckMailDelay = atoi(value);
  377.                if (!stricmp(buffer, "DownloadLarge"))  co->DownloadLarge = Txt2Bool(value);
  378.                if (!stricmp(buffer, "NotifyType"))     co->NotifyType = atoi(value);
  379.                if (!stricmp(buffer, "NotifySound"))    stccpy(co->NotifySound, value, SIZE_COMMAND);
  380.                if (!stricmp(buffer, "NotifyCommand"))  stccpy(co->NotifyCommand, value, SIZE_COMMAND);
  381. /*3*/          if (!strnicmp(buffer, "FI", 2) && buffer[4] == '.')
  382.                {
  383.                   int j = atoi(&buffer[2]);
  384.                   struct Rule *ru = co->RU[j];
  385.                   p = &buffer[5];
  386.                   if (!ru) ru = co->RU[j] = CO_NewRule();
  387.                   if (!stricmp(p, "Name"))       stccpy(ru->Name, value, SIZE_NAME);
  388.                   if (!stricmp(p, "Remote"))     ru->Remote = Txt2Bool(value);
  389.                   if (!stricmp(p, "ApplyToNew")) ru->ApplyToNew = Txt2Bool(value);
  390.                   if (!stricmp(p, "ApplyToSent"))ru->ApplyToSent = Txt2Bool(value);
  391.                   if (!stricmp(p, "ApplyOnReq")) ru->ApplyOnReq = Txt2Bool(value);
  392.                   if (!strnicmp(p, "Field", 5))       ru->Field[p[5]=='2'] = atoi(value);
  393.                   if (!strnicmp(p, "SubField", 8))    ru->SubField[p[8]=='2'] = atoi(value);
  394.                   if (!strnicmp(p, "CustomField", 11)) stccpy(ru->CustomField[p[11]=='2'], value, SIZE_DEFAULT);
  395.                   if (!strnicmp(p, "Comparison", 10)) ru->Comparison[p[10]=='2'] = atoi(value);
  396.                   if (!strnicmp(p, "Match", 5))       stccpy(ru->Match[p[5]=='2'], value2, SIZE_PATTERN);
  397.                   if (!strnicmp(p, "CaseSens", 8))    ru->CaseSens[p[8]=='2'] = Txt2Bool(value);
  398.                   if (!strnicmp(p, "Substring", 9))   ru->Substring[p[9]=='2'] = Txt2Bool(value);
  399.                   if (!stricmp(p, "Combine"))    ru->Combine = atoi(value);
  400.                   if (!stricmp(p, "Actions"))    ru->Actions = atoi(value);
  401.                   if (!stricmp(p, "BounceTo"))   stccpy(ru->BounceTo, value, SIZE_ADDRESS);
  402.                   if (!stricmp(p, "ForwardTo"))  stccpy(ru->ForwardTo, value, SIZE_ADDRESS);
  403.                   if (!stricmp(p, "ReplyFile"))  stccpy(ru->ReplyFile, value, SIZE_PATHFILE);
  404.                   if (!stricmp(p, "ExecuteCmd")) stccpy(ru->ExecuteCmd, value, SIZE_COMMAND);
  405.                   if (!stricmp(p, "PlaySound"))  stccpy(ru->PlaySound, value, SIZE_PATHFILE);
  406.                   if (!stricmp(p, "MoveTo"))     stccpy(ru->MoveTo, value, SIZE_NAME);
  407.                }
  408. /*4*/          if (!stricmp(buffer, "ShowHeader"))     co->ShowHeader = atoi(value);
  409.                if (!stricmp(buffer, "ShortHeaders"))   stccpy(co->ShortHeaders, value, SIZE_PATTERN);
  410.                if (!stricmp(buffer, "ShowSenderInfo")) co->ShowSenderInfo = atoi(value);
  411.                if (!stricmp(buffer, "WrapHeader"))     co->WrapHeader = Txt2Bool(value);
  412.                if (!stricmp(buffer, "SigSepLine"))     co->SigSepLine = atoi(value);
  413.                if (!stricmp(buffer, "ColoredText"))    stccpy(co->ColoredText.buf, value, 32);
  414.                if (!stricmp(buffer, "Color2ndLevel"))  stccpy(co->Color2ndLevel.buf, value, 32);
  415.                if (!stricmp(buffer, "DisplayAllTexts"))co->DisplayAllTexts = Txt2Bool(value);
  416.                if (!stricmp(buffer, "FixedFontEdit"))  co->FixedFontEdit = Txt2Bool(value);
  417.                if (!stricmp(buffer, "UseTextstyles"))  co->UseTextstyles = Txt2Bool(value);
  418.                if (!stricmp(buffer, "MultipleWindows"))co->MultipleWindows = Txt2Bool(value);
  419.                if (!stricmp(buffer, "TranslationIn"))  stccpy(co->TranslationIn, value, SIZE_PATHFILE);
  420. /*5*/          if (!stricmp(buffer, "ReplyTo"))        stccpy(co->ReplyTo,  value, SIZE_ADDRESS);
  421.                if (!stricmp(buffer, "Organization"))   stccpy(co->Organization, value, SIZE_DEFAULT);
  422.                if (!stricmp(buffer, "ExtraHeaders"))   stccpy(co->ExtraHeaders, value, SIZE_LARGE);
  423.                if (!stricmp(buffer, "NewIntro"))       stccpy(co->NewIntro, value2, SIZE_INTRO);
  424.                if (!stricmp(buffer, "Greetings"))      stccpy(co->Greetings, value2, SIZE_INTRO);
  425.                if (!stricmp(buffer, "TranslationOut")) stccpy(co->TranslationOut, value, SIZE_PATHFILE);
  426.                if (!stricmp(buffer, "EdWrapCol"))      co->EdWrapCol = atoi(value);
  427.                if (!stricmp(buffer, "EdWrapMode"))     co->EdWrapMode = atoi(value);
  428.                if (!stricmp(buffer, "Editor"))         stccpy(co->Editor, value, SIZE_PATHFILE);
  429.                if (!stricmp(buffer, "LaunchAlways"))   co->LaunchAlways = Txt2Bool(value);
  430. /*6*/          if (!stricmp(buffer, "ReplyHello"))     stccpy(co->ReplyHello, value2, SIZE_INTRO);
  431.                if (!stricmp(buffer, "ReplyIntro"))     stccpy(co->ReplyIntro, value2, SIZE_INTRO);
  432.                if (!stricmp(buffer, "ReplyBye"))       stccpy(co->ReplyBye, value2, SIZE_INTRO);
  433.                if (!stricmp(buffer, "AltReplyHello"))  stccpy(co->AltReplyHello, value2, SIZE_INTRO);
  434.                if (!stricmp(buffer, "AltReplyIntro"))  stccpy(co->AltReplyIntro, value2, SIZE_INTRO);
  435.                if (!stricmp(buffer, "AltReplyBye"))    stccpy(co->AltReplyBye, value2, SIZE_INTRO);
  436.                if (!stricmp(buffer, "AltReplyPattern"))stccpy(co->AltReplyPattern, value2, SIZE_PATTERN);
  437.                if (!stricmp(buffer, "MLReplyHello"))   stccpy(co->MLReplyHello, value2, SIZE_INTRO);
  438.                if (!stricmp(buffer, "MLReplyIntro"))   stccpy(co->MLReplyIntro, value2, SIZE_INTRO);
  439.                if (!stricmp(buffer, "MLReplyBye"))     stccpy(co->MLReplyBye, value2, SIZE_INTRO);
  440.                if (!stricmp(buffer, "ForwardIntro"))   stccpy(co->ForwardIntro, value2, SIZE_INTRO);
  441.                if (!stricmp(buffer, "ForwardFinish"))  stccpy(co->ForwardFinish, value2, SIZE_INTRO);
  442.                if (!stricmp(buffer, "QuoteMessage"))   co->QuoteMessage = Txt2Bool(value);
  443.                if (!stricmp(buffer, "QuoteText"))      stccpy(co->QuoteText, value2, SIZE_SMALL);
  444.                if (!stricmp(buffer, "QuoteEmptyLines"))co->QuoteEmptyLines = Txt2Bool(value);
  445.                if (!stricmp(buffer, "CompareAddress")) co->CompareAddress = Txt2Bool(value);
  446.                if (!stricmp(buffer, "StripSignature")) co->StripSignature = Txt2Bool(value);
  447. /*7*/          if (!stricmp(buffer, "UseSignature"))   co->UseSignature = Txt2Bool(value);
  448.                if (!stricmp(buffer, "TagsFile"))       stccpy(co->TagsFile, value, SIZE_PATHFILE);
  449.                if (!stricmp(buffer, "TagsSeparator"))  stccpy(co->TagsSeparator, value2, SIZE_SMALL);
  450. /*8*/          if (!stricmp(buffer, "FolderCols"))     co->FolderCols = atoi(value);
  451.                if (!stricmp(buffer, "MessageCols"))    co->MessageCols = atoi(value);
  452.                if (!stricmp(buffer, "FixedFontList"))  co->FixedFontList = Txt2Bool(value);
  453.                if (!stricmp(buffer, "SwatchBeat"))     co->SwatchBeat = Txt2Bool(value);
  454. /*9*/          if (!stricmp(buffer, "PGPCmdPath"))     stccpy(co->PGPCmdPath, value, SIZE_PATH);
  455.                if (!stricmp(buffer, "MyPGPID"))        stccpy(co->MyPGPID, value, SIZE_DEFAULT);
  456.                if (!stricmp(buffer, "EncryptToSelf"))  co->EncryptToSelf = Txt2Bool(value);
  457.                if (!stricmp(buffer, "ReMailer"))       stccpy(co->ReMailer, value, SIZE_ADDRESS);
  458.                if (!stricmp(buffer, "RMCommands"))     stccpy(co->RMCommands, value2, SIZE_INTRO);
  459.                if (!stricmp(buffer, "LogfilePath"))    stccpy(co->LogfilePath, value, SIZE_PATH);
  460.                if (!stricmp(buffer, "LogfileMode"))    co->LogfileMode = atoi(value);
  461.                if (!stricmp(buffer, "SplitLogfile"))   co->SplitLogfile = Txt2Bool(value);
  462.                if (!stricmp(buffer, "LogAllEvents"))   co->LogAllEvents = Txt2Bool(value);
  463. /*10*/         if (!stricmp(buffer, "GetOnStartup"))   co->GetOnStartup = Txt2Bool(value);
  464.                if (!stricmp(buffer, "SendOnStartup"))  co->SendOnStartup = Txt2Bool(value);
  465.                if (!stricmp(buffer, "CleanupOnStartup")) co->CleanupOnStartup = Txt2Bool(value);
  466.                if (!stricmp(buffer, "RemoveOnStartup"))  co->RemoveOnStartup = Txt2Bool(value);
  467.                if (!stricmp(buffer, "LoadAllFolders")) co->LoadAllFolders = Txt2Bool(value);
  468.                if (!stricmp(buffer, "UpdateNewMail"))  co->UpdateNewMail = Txt2Bool(value);
  469.                if (!stricmp(buffer, "CheckBirthdates"))co->CheckBirthdates = Txt2Bool(value);
  470.                if (!stricmp(buffer, "SendOnQuit"))     co->SendOnQuit = Txt2Bool(value);
  471.                if (!stricmp(buffer, "CleanupOnQuit"))  co->CleanupOnQuit = Txt2Bool(value);
  472.                if (!stricmp(buffer, "RemoveOnQuit"))   co->RemoveOnQuit = Txt2Bool(value);
  473. /*11*/         if (!strnicmp(buffer, "MV", 2) && buffer[4] == '.')
  474.                {
  475.                   int j = atoi(&buffer[2]);
  476.                   struct MimeView *mv = co->MV[j];
  477.                   p = &buffer[5];
  478.                   if (!mv) mv = co->MV[j] = CO_NewMimeView();
  479.                   if (!stricmp(p, "ContentType")) stccpy(mv->ContentType, value, SIZE_CTYPE);
  480.                   if (!stricmp(p, "Extension"))   stccpy(mv->Extension, value, SIZE_NAME);
  481.                   if (!stricmp(p, "Command"))     stccpy(mv->Command, value, SIZE_COMMAND);
  482.                }
  483.                if (!stricmp(buffer, "IdentifyBin"))    co->IdentifyBin = Txt2Bool(value);
  484.                if (!stricmp(buffer, "DetachDir"))      stccpy(co->DetachDir, value, SIZE_PATH);
  485.                if (!stricmp(buffer, "AttachDir"))      stccpy(co->AttachDir, value, SIZE_PATH);
  486. /*12*/
  487.                if (!stricmp(buffer, "GalleryDir"))     stccpy(co->GalleryDir, value, SIZE_PATH);
  488.                if (!stricmp(buffer, "MyPictureURL"))   stccpy(co->MyPictureURL, value, SIZE_URL);
  489.                if (!stricmp(buffer, "ProxyServer"))    stccpy(co->ProxyServer, value, SIZE_HOST);
  490.                if (!stricmp(buffer, "NewAddrGroup"))   stccpy(co->NewAddrGroup, value, SIZE_NAME);
  491.                if (!stricmp(buffer, "AddToAddrbook"))  co->AddToAddrbook = atoi(value);
  492.                if (!stricmp(buffer, "AddMyInfo")    )  co->AddMyInfo= Txt2Bool(value);
  493.                if (!stricmp(buffer, "AddrbookCols"))   co->AddrbookCols = atoi(value);
  494. /*13*/         if (!strnicmp(buffer, "Rexx", 4) && buffer[6] == '.')
  495.                {
  496.                   int j = atoi(&buffer[4]);
  497.                   if (j < MAXRX)
  498.                   {
  499.                      p = &buffer[7];
  500.                      if (!stricmp(p, "Name"))       stccpy(co->RX[j].Name, value, SIZE_NAME);
  501.                      if (!stricmp(p, "Script"))     stccpy(co->RX[j].Script, value, SIZE_PATHFILE);
  502.                      if (!stricmp(p, "IsAmigaDOS")) co->RX[j].IsAmigaDOS = Txt2Bool(value);
  503.                      if (!stricmp(p, "UseConsole")) co->RX[j].UseConsole = Txt2Bool(value);
  504.                      if (!stricmp(p, "WaitTerm"))   co->RX[j].WaitTerm = Txt2Bool(value);
  505.                   }
  506.                }
  507. /*14*/         if (!stricmp(buffer, "TempDir"))        stccpy(co->TempDir, value, SIZE_PATH);
  508.                if (!stricmp(buffer, "IconPosition"))   sscanf(value, "%ld;%ld", &(co->IconPositionX), &(co->IconPositionY));
  509.                if (!stricmp(buffer, "IconifyOnQuit"))  co->IconifyOnQuit = Txt2Bool(value);
  510.                if (!stricmp(buffer, "Confirm"))        co->Confirm = Txt2Bool(value);
  511.                if (!stricmp(buffer, "ConfirmDelete"))  co->ConfirmDelete = atoi(value);
  512.                if (!stricmp(buffer, "RemoveAtOnce"))   co->RemoveAtOnce = Txt2Bool(value);
  513.                if (!stricmp(buffer, "SaveSent"))       co->SaveSent = Txt2Bool(value);
  514.                if (!stricmp(buffer, "MDN_Display"))    co->MDN_Display = atoi(value);
  515.                if (!stricmp(buffer, "MDN_Process"))    co->MDN_Process = atoi(value);
  516.                if (!stricmp(buffer, "MDN_Delete"))     co->MDN_Delete = atoi(value);
  517.                if (!stricmp(buffer, "MDN_Filter"))     co->MDN_Filter = atoi(value);
  518.                if (!stricmp(buffer, "SendMDNAtOnce"))  co->SendMDNAtOnce = Txt2Bool(value);
  519.                if (!stricmp(buffer, "XPKPack"))        { stccpy(co->XPKPack, value, 5); co->XPKPackEff = atoi(&value[5]); }
  520.                if (!stricmp(buffer, "XPKPackEncrypt")) { stccpy(co->XPKPackEncrypt, value, 5); co->XPKPackEncryptEff = atoi(&value[5]); }
  521.                if (!stricmp(buffer, "PackerCommand"))  stccpy(co->PackerCommand, value, SIZE_COMMAND);              
  522. /*Hidden*/     if (!stricmp(buffer, "LetterPart"))     co->LetterPart = atoi(value);
  523.                if (!stricmp(buffer, "WriteIndexes"))   co->WriteIndexes = atoi(value);
  524.                if (!stricmp(buffer, "AutoSave"))       co->AutoSave = atoi(value);
  525.                if (!stricmp(buffer, "SupportSite"))    stccpy(co->SupportSite, value, SIZE_HOST);
  526.                if (!stricmp(buffer, "JumpToNewMsg"))   co->JumpToNewMsg = Txt2Bool(value);
  527.                if (!stricmp(buffer, "PrinterCheck"))   co->PrinterCheck = Txt2Bool(value);
  528.                if (!stricmp(buffer, "IsOnlineCheck"))  co->IsOnlineCheck = Txt2Bool(value);
  529.                if (!stricmp(buffer, "IOCInterface"))   stccpy(co->IOCInterface, value, SIZE_SMALL);
  530.                if (!stricmp(buffer, "ConfirmOnQuit"))  co->ConfirmOnQuit = Txt2Bool(value);
  531.                if (!stricmp(buffer, "HideGUIElements")) co->HideGUIElements = atoi(value);
  532.                if (!stricmp(buffer, "LocalCharset"))   stccpy(co->LocalCharset, value, SIZE_CTYPE);
  533.                if (!stricmp(buffer, "StackSize"))      co->StackSize = atoi(value);
  534.             }
  535.          }
  536.          fclose(fh);
  537.          return TRUE;
  538.       }
  539.       fclose(fh);
  540.    }
  541.    return FALSE;
  542. }
  543. ///
  544. /// CO_GetConfig
  545. //  Fills form data of current section with data from configuration structure
  546. void CO_GetConfig(void)
  547. {
  548.    struct CO_GUIData *gui = &G->CO->GUI;
  549.    int i, modified;
  550.    struct MUI_PenSpec *ps;
  551.  
  552.    switch (G->CO->VisiblePage)
  553.    {
  554.       case 0:
  555.          GetMUIString(CE->RealName        ,gui->ST_REALNAME);
  556.          GetMUIString(CE->EmailAddress    ,gui->ST_EMAIL);
  557.          CE->TimeZone          = GetMUICycle  (gui->CY_TZONE)-12;
  558.          CE->DaylightSaving    = GetMUICheck  (gui->CH_DLSAVING);
  559.          break;
  560.       case 1:
  561.          GetMUIString(CE->SMTP_Server     ,gui->ST_SMTPHOST);
  562.          GetMUIString(CE->SMTP_Domain     ,gui->ST_DOMAIN);
  563.          CE->Allow8bit         = GetMUICheck  (gui->CH_SMTP8BIT);
  564.          break;
  565.       case 2:
  566.          CE->PreSelection      = GetMUICycle  (gui->CY_MSGSELECT);
  567.          CE->TransferWindow    = GetMUICycle  (gui->CY_TRANSWIN);
  568.          CE->AvoidDuplicates   = GetMUICheck  (gui->CH_AVOIDDUP);
  569.          CE->UpdateStatus      = GetMUICheck  (gui->CH_UPDSTAT);
  570.          CE->WarnSize          = GetMUIInteger(gui->ST_WARNSIZE);
  571.          CE->CheckMailDelay    = GetMUIInteger(gui->ST_INTERVAL);
  572.          CE->DownloadLarge     = GetMUICheck  (gui->CH_DLLARGE);
  573.          CE->NotifyType        = (GetMUICheck(gui->CH_NOTIREQ) ? NOTI_REQ : 0)
  574.                                + (GetMUICheck(gui->CH_NOTISOUND) ? NOTI_SOUND : 0)
  575.                                + (GetMUICheck(gui->CH_NOTICMD) ? NOTI_CMD : 0);
  576.          GetMUIString(CE->NotifySound         ,gui->ST_NOTISOUND);
  577.          GetMUIString(CE->NotifyCommand       ,gui->ST_NOTICMD);
  578.          break;
  579.       case 3:
  580.          for (i = 0; i < MAXRU; i++) DoMethod(gui->LV_RULES, MUIM_List_GetEntry, i, &(CE->RU[i]));
  581.          break;
  582.       case 4:
  583.          CE->ShowHeader        = GetMUICycle  (gui->CY_HEADER);
  584.          GetMUIString(CE->ShortHeaders        ,gui->ST_HEADERS);
  585.          CE->ShowSenderInfo    = GetMUICycle  (gui->CY_SENDERINFO);
  586.          CE->SigSepLine        = GetMUICycle  (gui->CY_SIGSEPLINE);
  587.          get(gui->CA_COLTEXT, MUIA_Pendisplay_Spec, &ps); CE->ColoredText = *ps;
  588.          get(gui->CA_COL2QUOT, MUIA_Pendisplay_Spec, &ps); CE->Color2ndLevel = *ps;
  589.          CE->DisplayAllTexts   = GetMUICheck  (gui->CH_ALLTEXTS);
  590.          CE->FixedFontEdit     = GetMUICheck  (gui->CH_FIXFEDIT);
  591.          CE->WrapHeader        = GetMUICheck  (gui->CH_WRAPHEAD);
  592.          CE->UseTextstyles     = GetMUICheck  (gui->CH_TEXTSTYLES);
  593.          CE->MultipleWindows   = GetMUICheck  (gui->CH_MULTIWIN);
  594.          GetMUIString(CE->TranslationIn       ,gui->ST_INTRANS);
  595.          break;
  596.       case 5:
  597.          GetMUIString(CE->ReplyTo             ,gui->ST_REPLYTO);
  598.          GetMUIString(CE->Organization        ,gui->ST_ORGAN);
  599.          GetMUIString(CE->ExtraHeaders        ,gui->ST_EXTHEADER);
  600.          GetMUIString(CE->NewIntro            ,gui->ST_HELLOTEXT);
  601.          GetMUIString(CE->Greetings           ,gui->ST_BYETEXT);
  602.          GetMUIString(CE->TranslationOut      ,gui->ST_OUTTRANS);
  603.          CE->EdWrapCol         = GetMUIInteger(gui->ST_EDWRAP);
  604.          CE->EdWrapMode        = GetMUICycle  (gui->CY_EDWRAP);
  605.          GetMUIString(CE->Editor              ,gui->ST_EDITOR);
  606.          CE->LaunchAlways      = GetMUICheck  (gui->CH_LAUNCH);
  607.          break;
  608.       case 6:
  609.          GetMUIString(CE->ReplyHello          ,gui->ST_REPLYHI);
  610.          GetMUIString(CE->ReplyIntro          ,gui->ST_REPLYTEXT);
  611.          GetMUIString(CE->ReplyBye            ,gui->ST_REPLYBYE);
  612.          GetMUIString(CE->AltReplyHello       ,gui->ST_AREPLYHI);
  613.          GetMUIString(CE->AltReplyIntro       ,gui->ST_AREPLYTEXT);
  614.          GetMUIString(CE->AltReplyBye         ,gui->ST_AREPLYBYE);
  615.          GetMUIString(CE->AltReplyPattern     ,gui->ST_AREPLYPAT);
  616.          GetMUIString(CE->MLReplyHello        ,gui->ST_MREPLYHI);
  617.          GetMUIString(CE->MLReplyIntro        ,gui->ST_MREPLYTEXT);
  618.          GetMUIString(CE->MLReplyBye          ,gui->ST_MREPLYBYE);
  619.          GetMUIString(CE->ForwardIntro        ,gui->ST_FWDSTART);
  620.          GetMUIString(CE->ForwardFinish       ,gui->ST_FWDEND);
  621.          CE->QuoteMessage      = GetMUICheck  (gui->CH_QUOTE);
  622.          GetMUIString(CE->QuoteText           ,gui->ST_REPLYCHAR);
  623.          CE->QuoteEmptyLines   = GetMUICheck  (gui->CH_QUOTEEMPTY);
  624.          CE->CompareAddress    = GetMUICheck  (gui->CH_COMPADDR);
  625.          CE->StripSignature    = GetMUICheck  (gui->CH_STRIPSIG);
  626.          break;
  627.       case 7:
  628.          CE->UseSignature      = GetMUICheck  (gui->CH_USESIG);
  629.          GetMUIString(CE->TagsFile            ,gui->ST_TAGFILE);
  630.          GetMUIString(CE->TagsSeparator       ,gui->ST_TAGSEP);
  631.          get(gui->TE_SIGEDIT, MUIA_TextEditor_HasChanged, &modified);
  632.          if (modified) EditorToFile(gui->TE_SIGEDIT, CreateFilename(SigNames[G->CO->LastSig]), NULL);
  633.          break;
  634.       case 8:
  635.          CE->FolderCols = 1; for (i = 1; i < FOCOLNUM; i++) if (GetMUICheck(gui->CH_FCOLS[i])) CE->FolderCols += (1<<i);
  636.          CE->MessageCols = 1; for (i = 1; i < MACOLNUM; i++) if (GetMUICheck(gui->CH_MCOLS[i])) CE->MessageCols += (1<<i);
  637.          CE->FixedFontList = GetMUICheck(gui->CH_FIXFLIST);
  638.          CE->SwatchBeat    = GetMUICheck(gui->CH_BEAT);
  639.          break;
  640.       case 9:
  641.          GetMUIString(CE->PGPCmdPath          ,gui->ST_PGPCMD);
  642.          GetMUIString(CE->MyPGPID             ,gui->ST_MYPGPID);
  643.          CE->EncryptToSelf     = GetMUICheck  (gui->CH_ENCSELF);
  644.          GetMUIString(CE->ReMailer            ,gui->ST_REMAILER);
  645.          GetMUIString(CE->RMCommands          ,gui->ST_FIRSTLINE);
  646.          GetMUIString(CE->LogfilePath         ,gui->ST_LOGFILE);
  647.          CE->LogfileMode       = GetMUICycle  (gui->CY_LOGMODE);
  648.          CE->SplitLogfile      = GetMUICheck  (gui->CH_SPLITLOG);
  649.          CE->LogAllEvents      = GetMUICheck  (gui->CH_LOGALL);
  650.          break;
  651.       case 10:
  652.          CE->GetOnStartup      = GetMUICheck  (gui->CH_POPSTART);
  653.          CE->SendOnStartup     = GetMUICheck  (gui->CH_SENDSTART);
  654.          CE->CleanupOnStartup  = GetMUICheck  (gui->CH_DELETESTART);
  655.          CE->RemoveOnStartup   = GetMUICheck  (gui->CH_REMOVESTART);
  656.          CE->LoadAllFolders    = GetMUICheck  (gui->CH_LOADALL);
  657.          CE->UpdateNewMail     = GetMUICheck  (gui->CH_MARKNEW);
  658.          CE->CheckBirthdates   = GetMUICheck  (gui->CH_CHECKBD);
  659.          CE->SendOnQuit        = GetMUICheck  (gui->CH_SENDQUIT);
  660.          CE->CleanupOnQuit     = GetMUICheck  (gui->CH_DELETEQUIT);
  661.          CE->RemoveOnQuit      = GetMUICheck  (gui->CH_REMOVEQUIT);
  662.          break;
  663.       case 11:
  664.          GetMUIString(CE->MV[0]->Command      ,gui->ST_DEFVIEWER);
  665.          CE->IdentifyBin       = GetMUICheck  (gui->CH_IDENTBIN);
  666.          GetMUIString(CE->DetachDir           ,gui->ST_DETACHDIR);
  667.          GetMUIString(CE->AttachDir           ,gui->ST_ATTACHDIR);
  668.          break;
  669.       case 12:
  670.          GetMUIString(CE->GalleryDir          ,gui->ST_GALLDIR);
  671.          GetMUIString(CE->MyPictureURL        ,gui->ST_PHOTOURL);
  672.          GetMUIString(CE->NewAddrGroup        ,gui->ST_NEWGROUP);
  673.          GetMUIString(CE->ProxyServer         ,gui->ST_PROXY);
  674.          CE->AddToAddrbook     = GetMUICycle  (gui->CY_ATAB);
  675.          CE->AddMyInfo         = GetMUICheck  (gui->CH_ADDINFO);
  676.          CE->AddrbookCols = 1; for (i = 1; i < ABCOLNUM; i++) if (GetMUICheck(gui->CH_ACOLS[i])) CE->AddrbookCols += (1<<i);
  677.          break;
  678.       case 14:
  679.          GetMUIString(CE->TempDir             ,gui->ST_TEMPDIR);
  680.          CE->IconPositionX     = GetMUIInteger(gui->ST_APPX);
  681.          CE->IconPositionY     = GetMUIInteger(gui->ST_APPY);
  682.          CE->IconifyOnQuit     = GetMUICheck  (gui->CH_CLGADGET);
  683.          CE->Confirm           = GetMUICheck  (gui->CH_CONFIRM);
  684.          CE->ConfirmDelete     = GetMUINumer  (gui->NB_CONFIRMDEL);
  685.          CE->RemoveAtOnce      = GetMUICheck  (gui->CH_REMOVE);
  686.          CE->SaveSent          = GetMUICheck  (gui->CH_SAVESENT);
  687.          CE->MDN_Display       = GetMUIRadio  (gui->RA_MDN_DISP);
  688.          CE->MDN_Process       = GetMUIRadio  (gui->RA_MDN_PROC);
  689.          CE->MDN_Delete        = GetMUIRadio  (gui->RA_MDN_DELE);
  690.          CE->MDN_Filter        = GetMUIRadio  (gui->RA_MDN_RULE);
  691.          CE->SendMDNAtOnce     = GetMUICheck  (gui->CH_SEND_MDN);
  692.          GetMUIText(CE->XPKPack               ,gui->TX_PACKER);
  693.          GetMUIText(CE->XPKPackEncrypt        ,gui->TX_ENCPACK);
  694.          CE->XPKPackEff        = GetMUINumer  (gui->NB_PACKER);
  695.          CE->XPKPackEncryptEff = GetMUINumer  (gui->NB_ENCPACK);
  696.          GetMUIString(CE->PackerCommand       ,gui->ST_ARCHIVER);
  697.          break;
  698.    }
  699. }
  700. ///
  701. /// CO_SetConfig
  702. //  Sets current section of configuration structure with data from GUI
  703. void CO_SetConfig(void)
  704. {
  705.    struct CO_GUIData *gui = &G->CO->GUI;
  706.    struct POP3 *pop3;
  707.    int i;
  708.    switch (G->CO->VisiblePage)
  709.    {
  710.       case 0:
  711.          setstring   (gui->ST_REALNAME  ,CE->RealName);
  712.          setstring   (gui->ST_EMAIL     ,CE->EmailAddress);
  713.          setcycle    (gui->CY_TZONE     ,CE->TimeZone+12);
  714.          setcheckmark(gui->CH_DLSAVING  ,CE->DaylightSaving);
  715.          nnset(gui->ST_POPHOST0, MUIA_String_Contents, CE->P3[0]->Server);
  716.          nnset(gui->ST_PASSWD0,  MUIA_String_Contents, CE->P3[0]->Password);
  717.          break;
  718.       case 1:
  719.          setstring   (gui->ST_SMTPHOST  ,CE->SMTP_Server);
  720.          setstring   (gui->ST_DOMAIN    ,CE->SMTP_Domain);
  721.          setcheckmark(gui->CH_SMTP8BIT  ,CE->Allow8bit);
  722.          DoMethod(gui->LV_POP3, MUIM_List_Clear);
  723.          for (i = 0; i < MAXP3; i++) if (pop3 = CE->P3[i])
  724.          {
  725.             sprintf(pop3->Account, "%s@%s", pop3->User, pop3->Server);
  726.             DoMethod(gui->LV_POP3, MUIM_List_InsertSingle, pop3, MUIV_List_Insert_Bottom);
  727.          }
  728.          break;
  729.       case 2:
  730.          setcheckmark(gui->CH_AVOIDDUP  ,CE->AvoidDuplicates);
  731.          setcycle    (gui->CY_MSGSELECT ,CE->PreSelection);
  732.          setcycle    (gui->CY_TRANSWIN  ,CE->TransferWindow);
  733.          setcheckmark(gui->CH_UPDSTAT   ,CE->UpdateStatus);
  734.          set(gui->ST_WARNSIZE, MUIA_String_Integer, CE->WarnSize);
  735.          set(gui->ST_INTERVAL, MUIA_String_Integer, CE->CheckMailDelay);
  736.          setcheckmark(gui->CH_DLLARGE   ,CE->DownloadLarge);
  737.          setcheckmark(gui->CH_NOTIREQ   ,(CE->NotifyType&NOTI_REQ)!=0);
  738.          setcheckmark(gui->CH_NOTISOUND ,(CE->NotifyType&NOTI_SOUND)!=0);
  739.          setcheckmark(gui->CH_NOTICMD   ,(CE->NotifyType&NOTI_CMD)!=0);
  740.          setstring   (gui->ST_NOTISOUND ,CE->NotifySound);
  741.          setstring   (gui->ST_NOTICMD   ,CE->NotifyCommand);
  742.          break;
  743.       case 3:
  744.          DoMethod(gui->LV_RULES, MUIM_List_Clear);
  745.          for (i = 0; i < MAXRU; i++) if (CE->RU[i]) DoMethod(gui->LV_RULES, MUIM_List_InsertSingle, CE->RU[i], MUIV_List_Insert_Bottom);
  746.          break;
  747.       case 4:
  748.          setcycle    (gui->CY_HEADER    ,CE->ShowHeader);
  749.          setstring   (gui->ST_HEADERS   ,CE->ShortHeaders);
  750.          setcycle    (gui->CY_SENDERINFO,CE->ShowSenderInfo);
  751.          setcycle    (gui->CY_SIGSEPLINE,CE->SigSepLine);
  752.          set(gui->CA_COLTEXT, MUIA_Pendisplay_Spec, &CE->ColoredText);
  753.          set(gui->CA_COL2QUOT, MUIA_Pendisplay_Spec, &CE->Color2ndLevel);
  754.          setcheckmark(gui->CH_ALLTEXTS  ,CE->DisplayAllTexts);
  755.          setcheckmark(gui->CH_FIXFEDIT  ,CE->FixedFontEdit);
  756.          setcheckmark(gui->CH_WRAPHEAD  ,CE->WrapHeader);
  757.          setcheckmark(gui->CH_TEXTSTYLES,CE->UseTextstyles);
  758.          setcheckmark(gui->CH_MULTIWIN  ,CE->MultipleWindows);
  759.          setstring   (gui->ST_INTRANS   ,CE->TranslationIn);
  760.          break;
  761.       case 5:
  762.          setstring   (gui->ST_REPLYTO   ,CE->ReplyTo);
  763.          setstring   (gui->ST_ORGAN     ,CE->Organization);
  764.          setstring   (gui->ST_EXTHEADER ,CE->ExtraHeaders);
  765.          setstring   (gui->ST_HELLOTEXT ,CE->NewIntro);
  766.          setstring   (gui->ST_BYETEXT   ,CE->Greetings);
  767.          setstring   (gui->ST_OUTTRANS  ,CE->TranslationOut);
  768.          set(gui->ST_EDWRAP, MUIA_String_Integer, CE->EdWrapCol);
  769.          setcycle    (gui->CY_EDWRAP    ,CE->EdWrapMode);
  770.          setstring   (gui->ST_EDITOR    ,CE->Editor);
  771.          setcheckmark(gui->CH_LAUNCH    ,CE->LaunchAlways);
  772.          break;
  773.       case 6:
  774.          setstring   (gui->ST_REPLYHI   ,CE->ReplyHello);
  775.          setstring   (gui->ST_REPLYTEXT ,CE->ReplyIntro);
  776.          setstring   (gui->ST_REPLYBYE  ,CE->ReplyBye);
  777.          setstring   (gui->ST_AREPLYHI  ,CE->AltReplyHello);
  778.          setstring   (gui->ST_AREPLYTEXT,CE->AltReplyIntro);
  779.          setstring   (gui->ST_AREPLYBYE ,CE->AltReplyBye);
  780.          setstring   (gui->ST_AREPLYPAT ,CE->AltReplyPattern);
  781.          setstring   (gui->ST_MREPLYHI  ,CE->MLReplyHello);
  782.          setstring   (gui->ST_MREPLYTEXT,CE->MLReplyIntro);
  783.          setstring   (gui->ST_MREPLYBYE ,CE->MLReplyBye);
  784.          setstring   (gui->ST_FWDSTART  ,CE->ForwardIntro);
  785.          setstring   (gui->ST_FWDEND    ,CE->ForwardFinish);
  786.          setcheckmark(gui->CH_QUOTE     ,CE->QuoteMessage);
  787.          setstring   (gui->ST_REPLYCHAR ,CE->QuoteText);
  788.          setcheckmark(gui->CH_QUOTEEMPTY,CE->QuoteEmptyLines);
  789.          setcheckmark(gui->CH_COMPADDR  ,CE->CompareAddress);
  790.          setcheckmark(gui->CH_STRIPSIG  ,CE->StripSignature);
  791.          break;
  792.       case 7:
  793.          setcheckmark(gui->CH_USESIG    ,CE->UseSignature);
  794.          setstring   (gui->ST_TAGFILE   ,CE->TagsFile);
  795.          setstring   (gui->ST_TAGSEP    ,CE->TagsSeparator);
  796.          setcycle    (gui->CY_SIGNAT    ,G->CO->LastSig);
  797.          FileToEditor(CreateFilename(SigNames[G->CO->LastSig]), gui->TE_SIGEDIT);
  798.          break;
  799.       case 8:
  800.          for (i = 0; i < FOCOLNUM; i++) setcheckmark(gui->CH_FCOLS[i], (CE->FolderCols & (1<<i)) != 0);
  801.          for (i = 0; i < MACOLNUM; i++) setcheckmark(gui->CH_MCOLS[i], (CE->MessageCols & (1<<i)) != 0);
  802.          setcheckmark(gui->CH_FIXFLIST  ,CE->FixedFontList);
  803.          setcheckmark(gui->CH_BEAT      ,CE->SwatchBeat);
  804.          break;
  805.       case 9:
  806.          setstring   (gui->ST_PGPCMD    ,CE->PGPCmdPath);
  807.          setstring   (gui->ST_MYPGPID   ,CE->MyPGPID);
  808.          setcheckmark(gui->CH_ENCSELF   ,CE->EncryptToSelf);
  809.          setstring   (gui->ST_REMAILER  ,CE->ReMailer);
  810.          setstring   (gui->ST_FIRSTLINE ,CE->RMCommands);
  811.          setstring   (gui->ST_LOGFILE   ,CE->LogfilePath);
  812.          setcycle    (gui->CY_LOGMODE   ,CE->LogfileMode);
  813.          setcheckmark(gui->CH_SPLITLOG  ,CE->SplitLogfile);
  814.          setcheckmark(gui->CH_LOGALL    ,CE->LogAllEvents);
  815.          break;
  816.       case 10:
  817.          setcheckmark(gui->CH_POPSTART   ,CE->GetOnStartup);
  818.          setcheckmark(gui->CH_SENDSTART  ,CE->SendOnStartup);
  819.          setcheckmark(gui->CH_DELETESTART,CE->CleanupOnStartup);
  820.          setcheckmark(gui->CH_REMOVESTART,CE->RemoveOnStartup);
  821.          setcheckmark(gui->CH_LOADALL    ,CE->LoadAllFolders);
  822.          setcheckmark(gui->CH_MARKNEW    ,CE->UpdateNewMail);
  823.          setcheckmark(gui->CH_CHECKBD    ,CE->CheckBirthdates);
  824.          setcheckmark(gui->CH_SENDQUIT   ,CE->SendOnQuit);
  825.          setcheckmark(gui->CH_DELETEQUIT ,CE->CleanupOnQuit);
  826.          setcheckmark(gui->CH_REMOVEQUIT ,CE->RemoveOnQuit);
  827.          break;
  828.       case 11:
  829.          DoMethod(gui->LV_MIME, MUIM_List_Clear);
  830.          for (i = 1; i < MAXMV; i++) if (CE->MV[i]) DoMethod(gui->LV_MIME, MUIM_List_InsertSingle, CE->MV[i], MUIV_List_Insert_Bottom);
  831.          setstring   (gui->ST_DEFVIEWER ,CE->MV[0]->Command);
  832.          setcheckmark(gui->CH_IDENTBIN  ,CE->IdentifyBin);
  833.          setstring   (gui->ST_DETACHDIR ,CE->DetachDir);
  834.          setstring   (gui->ST_ATTACHDIR ,CE->AttachDir);
  835.          break;
  836.       case 12:
  837.          setstring   (gui->ST_GALLDIR   ,CE->GalleryDir);
  838.          setstring   (gui->ST_PHOTOURL  ,CE->MyPictureURL);
  839.          setstring   (gui->ST_NEWGROUP  ,CE->NewAddrGroup);
  840.          setstring   (gui->ST_PROXY     ,CE->ProxyServer);
  841.          setcycle    (gui->CY_ATAB      ,CE->AddToAddrbook);
  842.          setcheckmark(gui->CH_ADDINFO   ,CE->AddMyInfo);
  843.          for (i = 0; i < ABCOLNUM; i++) setcheckmark(gui->CH_ACOLS[i], (CE->AddrbookCols & (1<<i)) != 0);
  844.          break;
  845.       case 13:
  846.          set(G->CO->GUI.LV_REXX, MUIA_List_Active, 0);
  847.          break;
  848.       case 14:
  849.          setstring   (gui->ST_TEMPDIR   ,CE->TempDir);
  850.          set(gui->ST_APPX, MUIA_String_Integer, CE->IconPositionX);
  851.          set(gui->ST_APPY, MUIA_String_Integer, CE->IconPositionY);
  852.          setcheckmark(gui->CH_CLGADGET  ,CE->IconifyOnQuit);
  853.          setcheckmark(gui->CH_CONFIRM   ,CE->Confirm);
  854.          setslider   (gui->NB_CONFIRMDEL,CE->ConfirmDelete);
  855.          setcheckmark(gui->CH_REMOVE    ,CE->RemoveAtOnce);
  856.          setcheckmark(gui->CH_SAVESENT  ,CE->SaveSent);
  857.          setmutex    (gui->RA_MDN_DISP  ,CE->MDN_Display);
  858.          setmutex    (gui->RA_MDN_PROC  ,CE->MDN_Process);
  859.          setmutex    (gui->RA_MDN_DELE  ,CE->MDN_Delete);
  860.          setmutex    (gui->RA_MDN_RULE  ,CE->MDN_Filter);
  861.          setcheckmark(gui->CH_SEND_MDN  ,CE->SendMDNAtOnce);
  862.          set(gui->TX_PACKER , MUIA_Text_Contents, CE->XPKPack);
  863.          set(gui->TX_ENCPACK, MUIA_Text_Contents, CE->XPKPackEncrypt);
  864.          setslider   (gui->NB_PACKER    ,CE->XPKPackEff);
  865.          setslider   (gui->NB_ENCPACK   ,CE->XPKPackEncryptEff);
  866.          setstring   (gui->ST_ARCHIVER  ,CE->PackerCommand);
  867.          break;
  868.    }
  869. }
  870. ///
  871.